/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package jogodenave;

import defaultPackage.Vector2;

/**
 *
 * @author Marcel
 */
public class Position {
    
    static private Vector2 cameraPosition;
    
    private Vector2 world;
    private Vector2 camera;
    
    Position(Vector2 position, boolean world, Vector2 camPos){
        Position.cameraPosition = camPos;
        if(world){
            this.world = position;
            this.camera = position.subtract(cameraPosition);
        }else{
            this.camera = position;
            this.world = position.add(cameraPosition);
        }
    }
    
    Position(Vector2 position, boolean world){
        this(position,world,Position.cameraPosition);
    }

    public static Vector2 getCameraPosition() {
        return cameraPosition;
    }

    public static void setCameraPosition(Vector2 cameraPosition) {
        Position.cameraPosition = cameraPosition;
    }

    public Vector2 getCamera() {
        return camera;
    }

    public Vector2 getWorld() {
        return world;
    }
 
    
    public void set(Vector2 position, boolean world){
        if(world){
            this.world = position;
            this.camera = position.subtract(cameraPosition);
        }else{
            this.camera = position;
            this.world = position.add(cameraPosition);
        }
    }
    
}